<!DOCTYPE html>
<!-- saved from url=(0087)https://ent.safe517.com/fdWebCompany/findView/replenish.purchased.purchased?newSearch=1 -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  






<title>万达食品安全追溯系统</title>
<script src="./jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="./custome.js" type="text/javascript" charset="utf-8"></script>	
<script src="./jquery.form.js" type="text/javascript"></script>
<script src="./popup.js" type="text/javascript"></script>
<script src="./common(1).js" type="text/javascript">_csrf&b02b984c-40c2-4d40-bb4c-e2c946d9878a</script>	
<script src="./common1.js" type="text/javascript" charset="utf-8"></script>
<script src="./plupload.full.min.js" type="text/javascript"></script>	
<script src="./reAlert.js" type="text/javascript"></script>	
<link href="./common.css" rel="stylesheet" type="text/css">
<link href="./style.css" rel="stylesheet" type="text/css">
<!-- 图片查看 -->
<script src="./jquery-rotate-2.3.min.js" type="text/javascript"></script>
<script src="./jquery.ui.js" type="text/javascript"></script>
<link href="./foximg.css" rel="stylesheet" type="text/css">
<script src="./foximg.js" type="text/javascript" charset="utf-8"></script>
<!-- <script src="../js/bigimg.js" type="text/javascript" charset="utf-8"></script> -->

<script type="text/javascript">
	var fileServer = "https://image.safe517.com/fdWebFile";
	var imgFilePath="https://image.safe517.com/fdWebFile";
	var circulationType="CATERING";
	var circulationParam={empFile:"从业人员_V20170815.xlsx", outputBatchFile:"发货台账导入_V20170511.xlsx",inputBatchFile:"进货台账导入_V20170511.xlsx",inputMat:"采购品", inputMatFile:"采购品导入_V20170815.xlsx",outputMat:"产出品", outputMatFile:"产出品导入_V20151130.xlsx", menu:"10001,",adminMenu:"10001,10017,11701,11702,11703,"};
	var circulationJobs={jobs:"企业负责人,厨师长,门店经理,大堂经理,原材料检验人员,食品安全负责人,采购负责人,分餐人员,专间操作人员,餐饮具消毒人员,餐饮主管人员,厨师,仓库负责人,仓管人员,其他"};
	/* $('input').bind('input propertychange', function() {
		alert("111");
		$(this).val($(this).val().replace(/([';])+|(--)+/g,"").replace(/<[^>]+>/g,""));
	}); */
	
    //gloabal ajax
    $(document).ajaxComplete(function( event,request, settings ) {
    	if( request.status === 302  || request.status===403){
    		window.location = "..";
    	}
    });
	  //点击查看大图
   $(function(){
	   $('div[rel="img"]').foximg(); 
   })  
	var oldajax = $.ajax;
	$.ajax = function(options){
		if(!(options.headers)){
			options.headers={};
		}
		options.headers['X-CSRF-TOKEN'] = 'b02b984c-40c2-4d40-bb4c-e2c946d9878a';
		return oldajax(options);
	};

	
	
	
	
</script>
</head><body><div id="loading" style="position: absolute; top: 50%; left: 50%; margin: 0px auto; height: 300px; z-index: 888; display: none;"><img src="./loading.gif"></div>
   
<title>万达食品安全追溯系统</title>


<div class="main_box">
         <div class="main_con">
          <h3 class="process_title"><span>当前位置: </span><a href="https://ent.safe517.com/fdWebCompany/findView/replenish.purchased.purchased?newSearch=1#" id="circulationType">采购品</a> 
              <div class="btn_opera" style="width:420px;"> 
              <!-- <a href="#" class="btn_export" style="width:180px;margin-left:20px">按照查询条件导出采购品</a>   -->
                   <input type="button" class="btn_add" value="新增采购品" id="addPurchased" onclick="window.location.href=&#39;../findView/replenish.purchased.purchased-add&#39;">

             		<input type="button" class="btn_add btn_export" value="导出查询结果"> 
              </div>
          </h3>
          <div class="query" style="min-width:960px">
                         <span id="purchasedId"><em>采购品名称;</em><input type="text" class="query_input" placeholder="请输入采购品名称" value="" name="name3" id="name1"></span>
               <span><em>商品包装条码：</em><input type="text" class="query_input" placeholder="请输入商品包装条码" value="" name="productionBarcode" id="productionBarcode"></span>
               <span><em>企业编码：</em><input type="text" class="query_input" placeholder="请输入企业编码" value="" name="code" id="code"></span>

               <input type="button" class="btn_query" value="查询">
          </div>
          <div class="table_box">
               <table class="table_list">
                    <thead>
                       <tr>
                           <th style="min-width:40px">序号</th>                 
                           <th style="min-width:150px" id="purchasedName">采购品名称</th>
                           <th style="min-width:40px">规格</th>
                           <th style="min-width:200px">生产单位 </th>
                           <th style="min-width:100px" id="purchasedClassify">采购品分类</th>
                           <th style="min-width:80px">商品包装条码</th>
                           <th style="min-width:80px">企业编码</th>
                            <th style="min-width:80px">产地</th>
                           <th style="min-width:120px">操作</th>
                       </tr>
                    </thead>
                    <tbody>

                    <tr class="even"><td class="td_ser">1</td><td>可乐</td><td>500ml</td><td>上海可口可乐</td><td>调味品</td><td>123456789</td><td>123456</td><td>上海</td><td class="td_opera"><a href="https://ent.safe517.com/fdWebCompany/findView/replenish.purchased.purchased-view?id=14234727" class="btn_green">查看</a><a href="https://ent.safe517.com/fdWebCompany/findView/replenish.purchased.purchased-editor?id=14234727" class="btn_green">编辑</a><a href="javascript:void(0)" class="btn_green" rel="popup" link="../findView/replenish.purchased.iframe-del?id=14234727" title="提示">删除</a></td></tr></tbody>
                 </table>
                 <p class="paging_box">
                   <span class="paging_head"><input type="button" value="首页" style="padding:3px 5px"></span>
                   <span class="paging_perv"><input type="button" value="&lt;&lt; 上一页" id="pre_page"></span><a href="https://ent.safe517.com/fdWebCompany/findView/replenish.purchased.purchased?newSearch=1#" id="page1" class="default">1</a>
                   <span class="paging_next"><input type="button" value="下一页 &gt;&gt;" id="next_page"></span>
                   <span class="paging_trailer"><input type="button" value="尾页" style="padding:3px 5px"></span>
                   <span class="num_text" id="totalPage">共<em>1</em>页</span><span class="num_text page_record">共<em>1</em>条记录</span>  
                   <span class="num_text">跳转 <input type="text" id="paging_num" value="" style="width:20px;height: 20px;" onkeyup="javascript:this.value=this.value.replace(/\D/g,&#39;&#39;)" maxlength="6"></span>
                   <span id="page_btn"><input class="paging_btn" id="page_btn" type="button" value="确定"></span> 
                 </p>
                 <div class="clear"></div>
          </div>
     </div>
</div>    
 
<script type="text/javascript">
var params = {"newSearch":"1"};
var pageNum=parseInt("1");
var totalPage;
var totalNum;
var pageSize=20;
var queryname="";
var productionBarcode="";
var code="";
var fileServer = "https://image.safe517.com/fdWebFile";

var imgFilePath="https://image.safe517.com/fdWebFile";
var circulationType="CATERING";
var circulationParam={empFile:"从业人员_V20170815.xlsx", outputBatchFile:"发货台账导入_V20170511.xlsx",inputBatchFile:"进货台账导入_V20170511.xlsx",inputMat:"采购品", inputMatFile:"采购品导入_V20170815.xlsx",outputMat:"产出品", outputMatFile:"产出品导入_V20151130.xlsx", menu:"10001,",adminMenu:"10001,10017,11701,11702,11703,"};
function search(pageNum){
	$("#loading").show();
	var toUrl="../inputManage/inputMaterial/queryInputMaterials/"+pageNum+"/"+pageSize;
	$.ajax({
	url:toUrl,
	type:"post",
    headers: { 
        'Accept': 'application/json',
        'Content-Type': 'application/json' 
    },
    dataType:'json',
	data:JSON.stringify(params),
	success:function(text) {
		if(text.status==0){
	         pageContentReset(text);
	          page(text);
	  		$("#totalPage em").text(totalPage);
			$("#paging_num").val(pageNum);
				$("#loading").hide();
		}

	 },   
	 error:function(text) {
     console.log(text.message);
  
	 }
	});
}


function pageContentReset(result){
	if(result!=null&&result.body.resultList.length>0){
		var resultList=result.body.resultList;
		console.log(resultList.lenght);
		console.log(resultList);
	    $("tbody").children().remove();
		for(var i=0;i<resultList.length;i++){
			var num=(pageNum-1)*pageSize+i+1;
			var id=resultList[i].id;
			var name2=isNullForTable(resultList[i].name);
			var productionBarcode=isNullForTable(resultList[i].productionBarcode);
			var code=isNullForTable(resultList[i].code);
			var spec=isNullForTable(resultList[i].spec);
			var manufacture=isNullForTable(resultList[i].manufacture);
			var typeGeneralValue=isNullForTable(resultList[i].typeGeneralValue);
			var placeOfProduction=isNullForTable(resultList[i].placeOfProduction);
			var $tr=$('<tr><td class="td_ser">'+num+'</td><td>'+name2+'</td><td>'+spec+'</td><td>'+manufacture+'</td><td>'+typeGeneralValue+'</td><td>'+productionBarcode+'</td><td>'+code+'</td><td>'+placeOfProduction+'</td><td class="td_opera"><a href="../findView/replenish.purchased.purchased-view?id='+id+'" class="btn_green">查看</a><a href="../findView/replenish.purchased.purchased-editor?id='+id+'" class="btn_green">编辑</a><a href="javascript:void(0)" class="btn_green" rel="popup" link="../findView/replenish.purchased.iframe-del?id='+id+'" title="提示">删除</a></td></tr>');
			if(i%2==0){
				$tr.addClass("even");
			}
			$("tbody").append($tr);
		}

	}
}

function huifu(){
	$(".btn_export").removeAttr("disabled");
}

	$(function(){
		if(circulationType=="CATERING"){
			circulationType=circulationParam.inputMat;
			$("#circulationType").text(circulationType);
			circulationType1="新增"+circulationType;
			$("#addPurchased").attr('value',circulationType1);
			circulationType2=circulationType+"名称";
			circulationType5=circulationType2+";";
			$("#purchasedId em").text(circulationType5);
			circulationType3="请输入"+circulationType2;
			$("#name1").attr('placeholder',circulationType3);
			$("#purchasedName").text(circulationType2);
			circulationType4=circulationType+"分类";
			$("#purchasedClassify").text(circulationType4);
		}else if(circulationType=="CIRCU"){
			circulationType=circulationParam.inputMat;
				$("#circulationType").text(circulationType);
				circulationType1="新增"+circulationType;
				$("#addPurchased").attr('value',circulationType1);
				circulationType2=circulationType+"名称";
				circulationType5=circulationType2+";";
				$("#purchasedId em").text(circulationType5);
				circulationType3="请输入"+circulationType2;
				$("#name1").attr('placeholder',circulationType3);
				$("#purchasedName").text(circulationType2);
				circulationType4=circulationType+"分类";
				$("#purchasedClassify").text(circulationType4);
		}else if(circulationType=="PROD"){
			circulationType=circulationParam.inputMat;
				$("#circulationType").text(circulationType);
				circulationType1="新增"+circulationType;
				$("#addPurchased").attr('value',circulationType1);
				circulationType2=circulationType+"名称";
				circulationType5=circulationType2+";";
				$("#purchasedId em").text(circulationType5);
				circulationType3="请输入"+circulationType2;
				$("#name1").attr('placeholder',circulationType3);
				$("#purchasedName").text(circulationType2);
				circulationType4=circulationType+"分类";
				$("#purchasedClassify").text(circulationType4);
		}
		$("#name1").val(queryname);
		$("#productionBarcode").val(productionBarcode);
		$("#code").val(code);
		if(pageNum==null||pageNum==""){
			pageNum=1;
		}
	    search(pageNum);
		 console.log(pageNum+":test");
	//上一页
	 $(".paging_perv").click(function(){
		if(pageNum==1){
			params.newSearch="1";
			search(pageNum);
		}else{
			$(".paging_box a").removeClass("default");
			pageNum +=-1;
			$("#page"+pageNum).addClass("default");
			params.newSearch="1";
			search(pageNum);
		}
	});
	//下一页
	$(".paging_next").click(function(){
		
		 console.log(pageNum+":test1");
		 console.log(totalPage+":test2");
		 if(pageNum<totalPage){
				$(".paging_box a").removeClass("default");
				pageNum +=1;
				$("#page"+pageNum).addClass("default");
				params.newSearch="1";
				search(pageNum) 
		 }else if(pageNum==totalPage){
			 params.newSearch="1";
			search(pageNum);
		}
	});
	
	//点击首页查询数据
	$(".paging_head").click(function(){
		pageNum=1;
		params.newSearch="1";
		search(pageNum);
	});
	//点击尾页查询数据
	$(".paging_trailer").click(function(){
		pageNum=totalPage;
		params.newSearch="1";
		search(pageNum);
	});
	//点击确定查询数据
	$("#page_btn").click(function(){
		var pageNo=$("#paging_num").val().trim();
		if(isNaN(pageNo)||pageNo==null||pageNo==""){
			return;
		}else{
		pageNum=$("#paging_num").val().trim();
		if(pageNum<1){
			pageNum=1;
			params.newSearch="1";
			search(pageNum);
		}else  if(pageNum>totalPage){
			pageNum=totalPage;
			params.newSearch="1";
			search(pageNum);
		}else{
			params.newSearch="1";
			search(pageNum);
		}
		}
	});
		
		//查询
		$(".btn_query").click(function(){
			$("tbody").children().remove();
			queryname =$("#name1").val().trim();
			productionBarcode=$("#productionBarcode").val().trim();
			code=$("#code").val().trim();
			params.name=queryname;
			params.productionBarcode=productionBarcode;
			params.code=code;
			pageNum=1;
			params.newSearch="1";
			search(pageNum);
		});
		
		$(".btn_export").click(function(){
			$(".btn_export").attr("disabled","true");
			materialName=$("#name1").val().trim();
			barcode =$("#productionBarcode").val().trim();
			queryCode =$("#code").val().trim();
			
			var exportParam={};

			exportParam.name3=materialName;
			exportParam.productionBarcode=barcode;
			exportParam.code=queryCode;
			
			$.ajax({
				url: "../inputManage/inputMaterial/queryInputMaterialsExport",
				type:"post",
			    headers: { 
			        'Accept': 'application/json',
			        'Content-Type': 'application/json' 
			    },
			    dataType:'json',
				data:JSON.stringify(exportParam),
				success:function(result){
					window.location.href=imgFilePath+result.body;
					 setTimeout('huifu()',10000);
				},
				error:function(){
					alert("结果异常，导出失败！");
					 setTimeout('huifu()',10000);
				}
			});
		});
		
	});
	
	function html_encode(str)   
	{   
	  var s = "";   
	  if (str.length == 0) return "";   
	  s = str.replace(/&/g, "&gt;");   
	  s = s.replace(/</g, "&lt;");   
	  s = s.replace(/>/g, "&gt;");   
	  s = s.replace(/ /g, "&nbsp;");   
	  s = s.replace(/\'/g, "&#39;");   
	  s = s.replace(/\"/g, "&quot;");   
	  s = s.replace(/\n/g, "<br>");   
	  return s;   
	}   

	  
	  function html_decode(str)   
	  {   
	    var s = "";   
	    if (str.length == 0) return "";   
	    s = str.replace(/&gt;/g, "&");   
	    s = s.replace(/&lt;/g, "<");   
	    s = s.replace(/&gt;/g, ">");   
	    s = s.replace(/&nbsp;/g, " ");   
	    s = s.replace(/&#39;/g, "\'");   
	    s = s.replace(/&quot;/g, "\"");   
	    s = s.replace(/<br>/g, "\n");   
	    return s;   
	  }
</script>
	

</body></html>